<template>
  <section
    class="absolute bottom-0 flex items-center gap-x-4 h-7 w-full px-2 bg-[#e2e9e0] text-xs"
  >
    <div class="item">字数: {{ wordCount }}</div>
    <li />
    <div class="item active-item" @click="spellcheck = !spellcheck">
      拼写检查: {{ spellcheck ? "打开" : "关闭" }}
    </div>
    <li />
    <div class="item active-item">
      文章更新于 : {{ articleStore.getCurrentArticle?.updateTime }}
    </div>
  </section>
</template>

<script setup lang="ts">
import { useArticleStore } from "@/store/modules/article";
import { spellcheck } from "../Main/index";
const articleStore = useArticleStore();
const wordCount = computed(() => {
  const text = articleStore.getCurrentArticle?.htmlContent;
  if (!text) return 0;
  return getWordCountFromHtml(text);
});
</script>

<style scoped lang="scss">
.active-item {
  @apply hover:bg-[#c4c7c2] cursor-pointer;
}

.item {
  @apply flex items-center justify-center h-full px-2;
}

li {
  list-style: none;
  height: 60%;
  background-color: gray;
  width: 1px;
}
</style>
